package main

// 以函数作为参数
import (
	"fmt"
	"time"
)

func foo3() {
	fmt.Println("foo start")
	time.Sleep(time.Second * 4)
	fmt.Println("foo end")
}
func bar3() {
	fmt.Println("bar start")
	time.Sleep(time.Second * 4)
	fmt.Println("bar end")
}
func TimeUse(f func()) {
	startTime := time.Now().Unix()
	f()
	endTime := time.Now().Unix()
	fmt.Println(endTime - startTime)
}

func main() {
	TimeUse(foo3)
	TimeUse(bar3)
}
